import { create } from "zustand"
import { immer } from "zustand/middleware/immer"

type WorkflowStoreState = {
  isNodeToolbarVisible: boolean
}

type WorkflowStoreActions = {
  setIsNodeToolbarVisible: (visible: boolean) => void
}

type WorkflowStore = WorkflowStoreState & WorkflowStoreActions

const useWorkflowStore = create<WorkflowStore>()(
  immer((set) => ({
    isNodeToolbarVisible: false,
    setIsNodeToolbarVisible: (visible: boolean) => {
      set((state) => {
        state.isNodeToolbarVisible = visible
      })
    }
  }))
)

export default useWorkflowStore
